home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / knowhow4 / choicebx.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-10  |  2.1 KB  |  72 lines

  1. #ifndef __CHOICE_BOX_H_
  2. #define __CHOICE_BOX_H_
  3.  
  4. #include "visible.h"
  5. #include "context.h"
  6. #include "item.h"
  7. #include "window.h"
  8.  
  9. class ChoiceBox : public Window, public Context
  10.     {
  11.     protected:
  12.     char* hot;            // string of hot keys
  13.     int pos;              // current position
  14.     int start;            // start position
  15.     loc itemSize;         // dimentions of item, calculated of given
  16.  
  17.  
  18.     int*   itemList;      // items, if they are integer
  19.     int raw, column;      // num of raws and columns in menu, calculated
  20.  
  21.     int available;        // if size is too small - do not show
  22.  
  23.         loc itemDistance;     // between items
  24.     Item* item;           // for system use
  25.     public:
  26.         int count;            // num of items, calculated
  27.         char** itemStrings;   // items, if they are strings
  28.  
  29.     ChoiceBox(rect coordinates, char* fName = "", char* h = "",
  30.            char* HOT = NULL, int POS = 1, int START = 1,
  31.            loc ITEMSIZE = loc(1, 1), char** ITEMSTRINGS = NULL,
  32.            int* ITEMLIST = NULL,
  33.            loc ITEMDISTANCE = loc(8, 8),
  34.            rect STATUSPOS = rect(0, 24, 79, 25),
  35.            int STATUSTYPE = 0, char** STATUSSTRINGS = NULL,
  36.            int* STATUSLIST = NULL,
  37.            int res = FIXED, int s = 3, BORDERS b_type = SHOW_BORDER,
  38.            BORDERS hdr_b_type = SHOW_BORDER, int pat = 0,
  39.            int hdr_pat = 0);
  40.     virtual ~ChoiceBox() { delete item; }
  41.  
  42.     int get_choice() { return pos; }
  43.     void moveTo(int number);
  44.         void endOfList();           // if EOL - moveto 1 or load new portion
  45.     void left();
  46.     void right();
  47.     void up();
  48.     void dn();
  49.     void home();
  50.     void end();
  51.     void pgUp();
  52.     void pgDn();
  53.     void toTop();
  54.     void toBottom();
  55.  
  56.         char** getItemStrings() { return itemStrings; }
  57.     void calcConsts();
  58.     virtual void calcItemsNumber() {}
  59.     rect getItemCoord();
  60.     virtual void showItem()    {}
  61.     int mouseOn(event where);  // on what position mouse pressed
  62.         int get_page_size() { return raw * column; }
  63.         int get_items_number() { return count; }
  64.  
  65.     virtual void show();
  66.         virtual void hide();
  67.     virtual void repose(rect new_coord);
  68.  
  69.     virtual void exe(int act = 0);
  70.     };
  71.  
  72. #endif __CHOICE_BOX_H_